project(QmlAttributes LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Qml)

set(EVENT_HEADERS	
    QmlEventGroup.h 	
	AttributeGroup.h	
	FavoriteAttributes.h 
	
)
set(EVENT_SOURCE  
	QmlEventGroup.cpp 
	AttributeGroup.cpp
	FavoriteAttributes.cpp	
)

set(EVENT_FILES_PRIVATE
	private/FavoriteAttributesPrivate.h
	private/FavoriteAttributesPrivate.cpp
)

set(EVENT_ALL 
	${EVENT_HEADERS}
	${EVENT_SOURCE}
	${EVENT_FILES_PRIVATE}
	${EVENT_ALL}
)


add_library(QmlAttributes SHARED
	../../../include/PluginObject.h
	${EVENT_ALL}
)

set_property(TARGET QmlAttributes PROPERTY FOLDER "Plugins")

target_link_libraries(QmlAttributes 
	PRIVATE Qt${QT_VERSION_MAJOR}::Core
	PRIVATE Qt${QT_VERSION_MAJOR}::Qml
)

install(TARGETS QmlAttributes
     BUNDLE  DESTINATION .
     RUNTIME DESTINATION ${CMAKE_INSTALL_PLUGINS}
 )

source_group("Sources" FILES  ${EVENT_SOURCE})
source_group("Headers" FILES  ${EVENT_HEADERS})
source_group("Private" FILES  ${EVENT_FILES_PRIVATE})

target_compile_definitions(QmlAttributes PRIVATE QMLATTRIBUTES_LIBRARY)
